<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>部直属企事业单位情况统计表</title>
</head>
<style>
    table{
        border-collapse: separate;
        border-spacing: 0px;
    }
td{
    text-align: center;
}
.title1{
    position: relative;
    top:30px;
    left: -30px;
}
.title2{
    position: relative;
    top:-30px;
    left: 30px;
}
</style>
<body>
    <div style="text-align: center"><span style="font-size: 23px;font-weight: bold">部直属企事业单位情况统计表</span></div>
    <div><span style="font-weight: bold">填报单位（盖章）：</span></div>
    <canvas id="line" style="display:none;"></canvas>
    <table border="1">
        <tr>
            <td rowspan="4" id="header" > <span class="title1">项目</span>  <span class="title2">类别</span> </td>
            <td colspan="6">事业单位</td>
            <td colspan="9">企业</td>
        </tr>
        <tr>
            <td rowspan="2">个数</td>
            <td rowspan="2">在岗职工人数</td>
            <td colspan="2">按经费来源分类</td>
            <td colspan="2">按规格分类</td>
            <td rowspan="2">个数</td>
            <td rowspan="2">在岗职工人数</td>
            <td colspan="3">按规模分类</td>
            <td colspan="2">按经营类型分类</td>
            <td rowspan="2">2003年资产总额（万元）</td>
            <td rowspan="2">2003年销售额总额（万元）</td>
        </tr>
        <tr>
            <td>财政补助单位</td>
            <td>经费自理单位</td>
            <td>司局级</td>
            <td>县处级</td>
            <td>大型</td>
            <td>中型</td>
            <td>小型</td>
            <td>直接服务水利</td>
            <td>其它</td>
            
        </tr>
        <tr>
            
            <td>1</td>
            <td>2</td>
            <td>3</td>
            <td>4</td>
            <td>5</td>
            <td>6</td>
            <td>7</td>
            <td>8</td>
            <td>9</td>
            <td>10</td>
            <td>11</td>
            <td>12</td>
            <td>13</td>
            <td>14</td>
            <td>15</td> 
        </tr>
        <tr style="height: 50px"> 
            <td>部直属单位直属企事业单位</td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr style="height: 50px">
            <td>省级部门直属企事业单位</td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr style="height: 70px">
            <td>说明</td>
            <td colspan="15">(1)b本表统计。。。。。。</td>
        </tr>
    </table>
</body>
<script>
    function line(header, line_width, line_color, line_number) {
        var table = document.getElementById(header);
        var xpos = table.clientWidth;
        var ypos = table.clientHeight;
        var canvas = document.getElementById('line');
        if (canvas.getContext) {
            var ctx = canvas.getContext('2d');
            ctx.clearRect(0, 0, xpos, ypos); //清空画布，多个表格时使用
            ctx.fill();
            ctx.lineWidth = line_width;
            ctx.strokeStyle = line_color;
            ctx.beginPath();
            switch (line_number) {
                case 1:
                    ctx.moveTo(0, 0);
                    ctx.lineTo(xpos, ypos);
                    break;
                default:
                    return 0;
            }
            ctx.stroke();
            ctx.closePath();
            document.getElementById(header).style.backgroundImage = 'url("' + ctx.canvas.toDataURL() + '")';
            // document.getElementById(header).style.background - attachment = 'fixed';
        }
    }
    window.onload = function () {
        line('header', 2, 'black', 1);
        //目标单元格，线的宽度，线的颜色，线的条数，1~3，
        //line('two',2,'black',2);
    }
    window.onresize = function () { //当窗口改变时，也随之改变
        //可以加上检测 宽度高度是否变化在执行函数
        line('header', 2, 'black', 3);
    }
</script>
</html>